home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / GUI_LIBR.ARJ / GUI_LIB.DOC < prev    next >
Text File  |  1992-08-17  |  29KB  |  824 lines

  1.     
  2.  
  3.  
  4.  
  5.  
  6. ****************************************************************************
  7.  
  8.                  Documentation for
  9.         GUI_LIB Library for Borland C++ and Turbo C++
  10.                 Version 1.0
  11. ****************************************************************************
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. All files included on this distribution diskette are copyrighted by
  23. LUDICROUS DATA - June, 1992 except EGAVGA.BGI, GOTH.CHR, and LITT.CHR.
  24.  
  25.     File contained herein include:
  26.         GUI_LIB.LIB             The library file itself
  27.         GUI_LIB.DOC             This file
  28.         DEMO.EXE                Demonstration file
  29.         DEMO.C                  Source code for DEMO.EXE
  30.         *.ICN                   Support files for the demo
  31.         *.BTN                   Support files for the demo
  32.         GUI_LIB.H               Header file needed to use
  33.                     GUI_LIB functions and objects
  34.         REGISTER.DOC            Product registration form
  35.         ICONEDIT.EXE            The ICONEDIT program
  36.         ICONEDIT.DOC            ICONEDIT documentation
  37.         EGAVGA.BGI              Borland BGI file for 640x480
  38.                     graphics. This file is included
  39.                     for the use of the demo program 
  40.                     only.
  41.         GOTH.CHR                These files are used in the
  42.         LITT.CHR                ICONEDIT program.
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.     Congratulations! You have just received one of the finest graphics 
  56.     libraries available for use with Borland C++ and Borland's Turbo C++ 
  57.     compilers. Using the GUI_LIB library will enable you to create 
  58.     graphic based applications to run in DOS just as easily as creating 
  59.     text based applications. The objects included in the library are all 
  60.     familiar objects, found in many commercially available software 
  61.     packages. They include pushbuttons, icons, text entry fields, and 
  62.     bitmaps to name just a few. Some of the features in this library are 
  63.     found nowhere else! Now you can harness the power and intuitiveness 
  64.     of the Graphic User Interface for use in your applications. From 
  65.     paint programs to databases, all of your programs can benefit from 
  66.     the use of graphics. 
  67.  
  68.     If you have not already done so, I would suggest that you stop 
  69.     reading this documentation for a moment to check out the demo 
  70.     provided on the distribution diskette. The name of the demo is 
  71.     simply DEMO.EXE. In order to run the demo you must first have 
  72.     loaded your mouse driver. Any Microsoft, Logitech, or compatible 
  73.     mouse will be fine. Also, be sure that the file EGAVGA.BGI is 
  74.     in the same directory as the DEMO.EXE file. Then from the DOS prompt 
  75.     type DEMO <ENTER>. The demo highlights most of the objects in 
  76.     the library. After viewing the demo, return to the documentation.
  77.  
  78.  
  79.                 SHAREWARE
  80. ****************************************************************************
  81.  
  82.     The GUI_LIB library and it's included files are being distributed as 
  83.     Shareware. They are complete and not crippled in any way. You are free 
  84.     to use these files for a 30 day period free of charge. You may not, 
  85.     however, distribute any works created with these files in any way, 
  86.     shape or form until you have registered your copy of the package. 
  87.     If after 30 days you decide to continue using the files in this 
  88.     package you are obligated to register with the author. The concept 
  89.     of Shareware helps to keep the cost of quality software low. Please 
  90.     do your part by registering this software. Use of the software 
  91.     contained in this package after 30 days without registration will 
  92.     bring about sever penalties.
  93.  
  94.     This software package is comparable with many retail libraries 
  95.     costing hundreds of dollars. It is through the concept of Shareware 
  96.     that I am able to bring this software to you at a much reduced cost. 
  97.     What's more, registered users will receive upgrades free of cost 
  98.     rather than at an upgrade cost. 
  99.  
  100.     The price of this package is as follows:
  101.  
  102.         Single user license - $25
  103.             includes free copy of the next major upgrade of the
  104.             package.
  105.  
  106.         Corporate user license - $50
  107.             includes free copy of the next major upgrade of the
  108.             package.
  109.  
  110.  
  111.     Please use the registration form included with this package to 
  112.     register your copy. The form can be found in the file REGISTER.DOC.
  113.  
  114.     Thank you
  115.  
  116.     If you like this product you may also wish to order the
  117.     ObjectEase library also from this author. This library makes it 
  118.     easy to migrate into the realm of C++ programming by offering
  119.     the widest range of classes available in any library at any
  120.     cost. Include a note on your registration form to receive a demo
  121.     of the ObjectEase library.
  122.  
  123.  
  124.  
  125.             Use of the GUI_LIB library
  126.  
  127.     In order to utilize the objects and functions in the GUI_LIB 
  128.     library you need only add the GUI_LIB library to your project, 
  129.     and include the header file in your program code. You can then 
  130.     declare object instances and call the functions as you would with 
  131.     any other library. You must, of course, first initialize the 
  132.     graphics mode with a call to initgraph(). The GUI_LIB library file 
  133.     was compiled under the large memory model using Borland C++ 3.0 
  134.     and should be included only in projects that are also to be compiled 
  135.     for the large memory model. This is because the use of graphics 
  136.     can be very memory intensive and the large memory model gives the 
  137.     program access to all of the available RAM, not just a single 64K 
  138.     data segment.
  139.  
  140.     This documentation is divided into sections describing each of the 
  141.     various graphic objects followed by a description and examples of 
  142.     all of the methods that may be used with the object. Please take 
  143.     special note of the example fragments as they may be of great help 
  144.     to you in getting to know the proper use of these objects and 
  145.     methods. 
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156. ****************************************************************************
  157.                    PANELS
  158. ****************************************************************************
  159.  
  160.     Panels can be associated with pop-up windows in a text environment. 
  161.     They serve to contain and draw attention to other objects such as 
  162.     text or pushbuttons. The class Panel is declared in the header 
  163.     file GROBJECT.H as:
  164.  
  165. class Panel:public Point
  166. {
  167.     protected:
  168.         int w;                          WIDTH
  169.         int h;                          HEIGHT
  170.         int in_or_out;                  CONCAVE or CONVEX
  171.         int thick_or_thin;              BORDER STYLE
  172.     public:
  173.         Panel();
  174.         ~Panel();
  175.         virtual void show();
  176.         void init(int xpos,int ypos,int width,int height,
  177.               int inorout,int thickorthin);
  178. };
  179.  
  180.  
  181.     The class POINT from which Panel is derived is the base class for 
  182.     all of the graphic objects in this library.
  183.  
  184.     In order to facilitate the initialization of the inorout and 
  185.     thickorthin variables the definitions IN, OUT, THICK and THIN 
  186.     may be used. These are defined in the header file.
  187.  
  188.     To declare an instance of class PANEL and display it in your 
  189.     application follow the example in the following code fragment.
  190.  
  191.     Panel mypanel;
  192.     mypanel.init(10,10,100,100,IN,THICK);
  193.     mypanel.show();
  194.  
  195.     It's just that simple. Remember that the graphics mode must first 
  196.     be initialized by a call to initgraph. If you are unfamiliar with 
  197.     this function consult your compiler documentation.
  198.  
  199.     All of the objects in this library contain the method "init". 
  200.     You must call "init" with the proper parameters before trying 
  201.     to display the object. There's no telling what might happen if 
  202.     you try to display an uninitialized object.
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. ****************************************************************************
  212.                  BEVELS
  213. ****************************************************************************
  214.  
  215.     Bevels are just like panels with a more decorative border. All 
  216.     calls to their methods are identical except that a call to 
  217.     Bevel.init() takes one less parameter. You do not need to specify 
  218.     IN or OUT because Bevel borders always go out. Here is the 
  219.     definition. I'll skip an example as you can easily follow the 
  220.     Panel example and make appropriate substitutions.
  221.  
  222. class Bevel:public Point
  223. {
  224.     private:
  225.         int w;                          WIDTH
  226.         int h;                          HEIGHT
  227.         int thick_or_thin;              STYLE OF BORDER
  228.         Panel outerbevel;
  229.         Panel innerbevel;
  230.     public:
  231.         void init(int,int,int,int,int);
  232.         virtual void show();
  233. };
  234.  
  235.  
  236.  
  237.  
  238.  
  239. ****************************************************************************
  240.                  PUSHBUTTONS
  241. ****************************************************************************
  242.  
  243.     Pushbuttons simulate keyboard keys on the screen. They serve to 
  244.     get user input for a variety of purposes. They are very intuitive 
  245.     and can display either a text title or a graphic image.
  246.  
  247. The header file definition of the class Button is:
  248.  
  249. class Button:public Point
  250. {
  251.   protected:
  252.     int state,                  UP or DOWN
  253.     int sizex,                  WIDTH
  254.     int sizey;                  HEIGHT
  255.     char btntxt[40];            TEXT ID 
  256.     int  file_text;             TEXT ID or GRAPHIC IMAGE
  257.     void *picture;              BUFFER CONTAINING GRAPHIC IMAGE
  258.     void getpic(char*);         
  259.   public:
  260.     Button();
  261.     ~Button();
  262.     virtual void show();
  263.     virtual void press();
  264.     void init(int xpos,int ypos,char* text,int);
  265.     int hit();
  266. };
  267.  
  268.     To declare an instance of class Button you need to supply the 
  269.     parameters for the upper left x and y positions, a string which 
  270.     either represents the text to be displayed on the button or the 
  271.     name of the file containing the image to be used on the button, 
  272.     and an integer flag representing whether or not the last parameter 
  273.     refers to text or a filename.
  274.  
  275. The definitions TEXT and IMAGE can be used in this parameter and are 
  276. defined in the header file.
  277.  
  278.     Consider this example:
  279.  
  280.     Button textbutton;
  281.     textbutton.init(10,10," EXIT ",TEXT);
  282.     textbutton.show();
  283.  
  284.     This would create and display a button that said " EXIT " on it.
  285.  
  286.     Consider this:
  287.  
  288.     Button graphbutton;
  289.     graphbutton.init(10,10,"EXIT",IMAGE);
  290.     graphbutton.show();
  291.  
  292.     This would create and display a button containing the image stored 
  293.     in the file "EXIT.BTN". The file extension should not be included 
  294.     in the parameter as ".BTN" is the assumed extension. The graphic 
  295.     file must be present on the disk before trying to call this function. 
  296.     Using the ICONEDIT program supplied with this package you can very 
  297.     easily create these graphics to be included on buttons.
  298.  
  299.     Note that you do not need to specify the width and height of buttons. 
  300.     If you are using text labels the button width is determined 
  301.     automatically to accomodate up to 40 characters, and if your are 
  302.     using graphics the button defaults to 20x20. This is the size of 
  303.     the button graphics created by the ICONEDIT program.
  304.  
  305.     Pressing the button is usually done with the mouse cursor, however, 
  306.     you may find it useful to use some other trigger to press the button. 
  307.     The button method "hit()" determines if the mouse cursor is within the 
  308.     boundaries of the button. For a detailed discussion on the use of the 
  309.     mouse functions see the appropriate section of this documentation. If 
  310.     you don't understand all of the functions in this next code fragment 
  311.     you can find explanations elsewhere in this document.
  312.  
  313.     Button mybutton;                       DECLARES INSTANCE OF BUTTON
  314.     mybutton.init(10,10,"EXIT",TEXT);      INITIALIZES MYBUTTON
  315.     mybutton.show();                       DISPLAYS MYBUTTON ON SCREEN
  316.  
  317.     while(!kbhit()) {                      DO THIS WHILE NO KEYS ARE HIT
  318.       if(leftmousekeypressed()) {          IF THE LEFT MOUSE KEY IS
  319.                            PRESSED
  320.         if(mybutton.hit()) {               IF MOUSE CURSOR IS ON MYBUTTON
  321.           mybutton.press();                DISPLAY MYBUTTON AS PRESSED
  322.           while(leftmousekeypressed());    WAIT UNTIL LEFT MOUSE KEY HAS
  323.                            BEEN RELEASED
  324.           mybutton.show();                 DISPLAY MYBUTTON IN NORMAL 
  325.                            STATE
  326.           }
  327.       }
  328.     }                       
  329.  
  330.     Immediately after restoring the button to the normal (undepressed) 
  331.     state the program can branch to take whatever action the button 
  332.     calls for.  By using the Button method "press()" all of the 
  333.     redrawing and repositioning of the text and/or graphic images is 
  334.     handled automatically by the GUI_LIB library.
  335.  
  336.  
  337.  
  338.  
  339.  
  340. ****************************************************************************
  341.                   COLORBUTTONS
  342. ****************************************************************************
  343.  
  344.     Colorbuttons don't do much except tell you when they are hit and
  345. return their current color. This is very useful if you are coding a paint
  346. program and need some way to set the current foreground and background colors.
  347. I'm sure you can find some other good uses for this class as well.
  348.  
  349.     The header definition of class Colorbutton is:
  350.  
  351.  
  352. class Colorbutton:public Point
  353. {
  354.     protected:
  355.         int color;
  356.         int width;
  357.         int height;
  358.     public:
  359.         void init(int,int,int,int,int);
  360.         void show(int);
  361.         int  hit();
  362.         int getcolor();
  363.         };
  364.  
  365.     Call "init()" with integer parameters for the x and y position,
  366. the width, the height, and the color of the button. Call "show()" with
  367. and integer value representing the color of the rectangle you wish to 
  368. have surrounding the Colorbutton. By manipulating this value you can 
  369. effectively show an "active" Colorbutton in a row of Colorbuttons. "Hit()"
  370. simply returns whether or not the mouse cursor is in the Colorbutton
  371. area, and "getcolor()" return the color of the Colorbutton.
  372.  
  373.     A quick way to make a color selection bar is as follows:
  374.  
  375. Colorbutton colorarray[16];
  376. for(int i=0;i<16;i++) {
  377.     colorarray[i].init(100+(i*20),100,20,20,i);
  378.     colorarray[i].show(15);
  379.     }
  380.  
  381.  
  382.  
  383.  
  384.  
  385. ****************************************************************************
  386.                  ICONS
  387. ****************************************************************************
  388.  
  389.     Icons can be used in much the same way as buttons. They will always 
  390.     contain a graphic image, although text can be a part of the graphic. 
  391.     They are not 3 dimensional like pushbuttons.
  392.  
  393.     The graphic images for these Icon objects are created using the 
  394.     ICONEDIT program. This program produces 32x32 pixel icons that can be 
  395.     single or multi-framed. More on this in a moment.
  396.  
  397. The definition of the Icon class is:
  398.  
  399. class Icon:public Point
  400. {
  401.     protected:
  402.         int state;                      SELECTED OR NOT
  403.     public:
  404.         void far *picture;              BUFFER CONTAINING GRAPHIC       
  405.     Icon();
  406.     ~Icon();
  407.         void init(int xpos,int ypos,char* fname);
  408.         void show();
  409.         void choose();
  410.         int hit();
  411.         int ispressed();
  412.     };
  413.  
  414.     Like the other graphic objects, the Icon class must first be 
  415.     initialized with a call to "init()." Init() takes three parameter, 
  416.     the x and y coordinates of the upper left corner, and the file name 
  417.     of the file containing the graphic image for the icon. The filename 
  418.     parameter should be given without an extension as the default 
  419.     extension ".ICN" is assumed. The file named in this parameter must 
  420.     exist in the current directory.
  421.  
  422.     Let's look at a short example:
  423.  
  424.     Icon myicon;
  425.     myicon.init(10,10,"paint");
  426.     myicon.show();
  427.  
  428.     This example declares an instance of class Icon using the file 
  429.     "paint.icn" as the graphic, and then displays the icon.
  430.  
  431.     As with the pushbutton, the method "hit()" determines if the 
  432.     mouse cursor is within the boundaries of the icon. If it is, 
  433.     and if a mouse key is pressed, we can change the appearance of 
  434.     the icon to mark it as selected using the method "choose()." Here's 
  435.     a quick example, similar to that presented for the pushbutton:
  436.  
  437.     Icon myicon;
  438.     myicon.init(10,10,"paint");
  439.     myicon.show();
  440.  
  441.     while(!kbhit()) {
  442.         if(leftmousekeypressed()) {
  443.             if(myicon.hit()) {
  444.                 if(!myicon.ispressed()) {
  445.                     myicon.choose();
  446.                     while(leftmousekeypressed());
  447.                     myicon.show();
  448.                     }
  449.                 }
  450.             }
  451.         }
  452.  
  453.     Usually when an icon has been selected you will want to make 
  454.     sure that the last icon to be selected gets reset to its normal 
  455.     state with a call to "show()." Whatever action needs to be taken 
  456.     as a result of the icon's selection can be done after the call to 
  457.     "choose()." The method "ispressed()" simply returns whether or not 
  458.     the icon is already displayed in its selected state.
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. ****************************************************************************
  467.                  ACTICONS
  468. ****************************************************************************
  469.  
  470.     Acticons are exactly like Icons except that instead of simply 
  471.     reversing their image to mark them as the selected icon, they 
  472.     become animated. Acticons are created using the ICONEDIT program. 
  473.     They are created in the same manner as an Icon, but instead of just 
  474.     a single frame graphic, they contain several (up to 32) frames.
  475.  
  476. Acticons are defined in the header file as follows:
  477.  
  478. class Acticon:public Icon
  479. {
  480.     protected:
  481.         void *picture[32];              GRAPHICS BUFFERS
  482.         int state;                      SELECTED OR NOT
  483.         int numpix;                     NUMBER OF FRAMES
  484.     public:
  485.         Acticon();
  486.         ~Acticon();
  487.         void init(int,int,char*);
  488.         void show(int);
  489.         void choose();
  490.         int ispressed();
  491.         void animate(int);
  492.         void backforth(int);
  493.     };
  494.  
  495.  
  496.     Like Icons, they are initialized with a call to "init()" with 
  497.     parameters for the upper left x and y coordinates, and the file 
  498.     name containing the graphic images. When you call "show()", however, 
  499.     you must supply an integer parameter specifying which frame to 
  500.     display. Usually you will want to make this frame 0 because if 
  501.     you call "choose()" the negative image of frame 0 will be displayed 
  502.     by default.
  503.  
  504.     For example:
  505.     
  506.     Acticon myicon;
  507.     myicon.init(10,10,"paint");
  508.     myicon.show(0);
  509.  
  510.     Just like an Icon except for the parameter in the call to "show()." 
  511.     If you want to use choose to show the reverse image of the Acticon 
  512.     it is done the same as it is for class Icon. If however you want 
  513.     to animate the Acticon you must call "animate()" or "backforth()." 
  514.     Both of these methods will put the Acticon in motion. "Animate()" 
  515.     will display the frames in ascending order and then restart at 
  516.     frame 0. "Backforth()" will display the frames in ascending order, 
  517.     but when it reaches the last frame it will then display the frames 
  518.     in reverse order back to frame 0. Both of these methods take a 
  519.     single parameter which specifies the delay between displaying each 
  520.     frame. This delay is expressed in eighteenths of a second. The 
  521.     lower the value, the faster the animation. You do not need to 
  522.     specify the number of frames in the Acticon as this information is 
  523.     contained in the graphic file created by ICONEDIT. Let's take a look:
  524.  
  525.     Acticon myicon;
  526.     myicon.init(10,10,"paint");
  527.     myicon.show(0);
  528.  
  529.     while(!kbhit()) {
  530.         if(leftmousekeypressed()) {
  531.             if(myicon.hit()) {
  532.                 while(leftmousekeypressed()) 
  533.                     myicon.animate(3);
  534.                 }
  535.             }
  536.         }
  537.  
  538.     In this code fragment, if the left mouse key is pressed while the 
  539.     cursor is on the Acticon, then the Acticon will animate for as long 
  540.     as the left mouse key is pressed. Note that "animate()" and 
  541.     "backforth()" will only change the animation by one frame, so for 
  542.     continuous motion you must include calls to these methods within 
  543.     some sort of loop.
  544.     
  545.  
  546.  
  547.  
  548.  
  549. ****************************************************************************
  550.                  GSTRINGS
  551. ****************************************************************************
  552.     
  553.     No, it's not something a stripper wears, the G in Gstring simply 
  554.     stands for graphic. These object are used for getting text input 
  555.     while in graphics mode. They display their own input fields and can 
  556.     handle all of the text editing keys like arrows, backspace, delete, 
  557.     etc...
  558.  
  559. Class Gstring is defined as:
  560.  
  561. class Gstring:public Tstring {
  562.     protected:
  563.         int curpos;                     CURSOR POSITION IN STRING
  564.         int curson;                     CURSOR ON OR OFF
  565.         void showcurs();
  566.         void hidecurs();
  567.     public:
  568.         void init(int xpos,int ypos,int length,int caps);
  569.         void show();
  570.         void input();
  571.         void get_input();
  572.         void get_form_input();
  573.         int isshown();
  574.         void check_for_blink();
  575.     };
  576.  
  577.     Once again a call to "init()" is necessary to begin. The necessary 
  578.     parameters are the x and y coordinates of the upper left corner of 
  579.     the input field, the length of the field, and an integer flag to 
  580.     indicate whether of not to force the input into all capital letters. 
  581.     Any nonzero value will force all caps. 
  582.  
  583.     Notice that Gstring is not derived from class Point as are all the 
  584.     other object, but is derived from class Tstring. Tstring is not a 
  585.     part of this graphics library, but performs the same functions as 
  586.     Gstring only in text mode.
  587.  
  588.     Two methods that are part of Tstring that you might find useful are 
  589.     "preset()" and "reset()." Call "preset()" with a string parameter 
  590.     that you wish to have displayed in the input field by default, and 
  591.     "reset()" with no parameters to clear the input field. For example, 
  592.     if you wanted the input field to be displayed with the preset value 
  593.     of "Married" you would use code similar to the following:
  594.  
  595.     Gstring mystring;
  596.     mystring.init(100,10,10,0);
  597.     mystring.preset("Married");
  598.     mystring.show();
  599.  
  600.     If you don't use the "preset()" method the input field will just 
  601.     be blank, probably what you want in most cases anyway. To allow 
  602.     user input just add the statement:
  603.     
  604.     mystring.get_input();
  605.  
  606.     This will allow text input until the user presses either <ESCAPE> 
  607.     or <ENTER>. You can test for the <ESCAPE> key with the Tstring 
  608.     method "escapehit()." Let's put it all together...
  609.  
  610.     Gstring mystring;
  611.     char *the_string;
  612.  
  613.     mystring.init(100,10,10,0);
  614.     mystring.get_input();
  615.     if(mystring.escapehit())
  616.         exit(0);
  617.     else
  618.     strcpy(the_string,mystring.getstring());
  619.  
  620.     The Tstring method "getstring()" returns a char * to the actual 
  621.     text string that was entered by the user.
  622.  
  623.  
  624.  
  625.  
  626.  
  627. ****************************************************************************
  628.                GMENUBUTTON and GMENU
  629. ****************************************************************************
  630.  
  631.  
  632.     The classes Gmenubutton and Gmenu provide the capabilities for you 
  633.     to include pulldown menus in you graphics applications. The 
  634.     Gmenubutton is simply the text that will appear in the menu bar 
  635.     whereas the Gmenu is the moving bar menu that will pop up when a 
  636.     Gmenubutton is selected. Since these two objects are so closely 
  637.     related I will discuss them together. Here are the definitions:
  638.  
  639. class Gmenu {
  640.       protected:
  641.         int on;
  642.         int x,y,w,h;
  643.         int num;
  644.         gitemarray gitems;
  645.         int menuchoice;
  646.         int oldbarx,oldbary;
  647.         void *ptr;
  648.         void *menubar;
  649.       public:
  650.         Gmenu();
  651.         ~Gmenu();
  652.         void init(int xloc,int yloc,int numentries,
  653.                gitemarray gitem);
  654.         int show();
  655.         void hide();
  656.         int isshown();
  657.       };
  658.  
  659. class Gmenubutton {
  660.         protected:
  661.           int on;
  662.           int x,y;
  663.           int offfgd,offbgd;
  664.           int onfgd,onbgd;
  665.           char id[20];
  666.         public:
  667.           Gmenubutton();
  668.           ~Gmenubutton();
  669.           void init(int xloc,int yloc,int ffgd,int fbgd,
  670.                 int nfgd,int nbgd,char txt[20]);
  671.           void show();
  672.           void press();
  673.           int hit();
  674.           };
  675.  
  676.     The data element gitemarray is a predefined two dimensional 
  677.     array containing the strings that will appear in the Gmenu. 
  678.     The maximum number of items in a Gmenu is 10, and the width of 
  679.     the pop-up menu is fixed at 100 pixels. When initializing the 
  680.     strings in the gitemarray always start at index 1 rather than 
  681.     index 0. Like this:
  682.  
  683.     gitemarray menu1array;
  684.     strcpy(menu1array[1],"ITEM 1");
  685.     strcpy(menu1array[2],"ITEM 2");
  686.     etc...
  687.  
  688.     A Gmenubutton is initialized with parameters for x and y screen 
  689.     locations, normal state fgd and bgd colors, selected state fgd 
  690.     and bgd colors, and the text to be displayed.
  691.  
  692.     A Gmenu is initialized with parameters for the x and y screen 
  693.     locations, the number of entries to be in the menu, and the 
  694.     gitemarray containing the item strings. The Gmenu is popped-up 
  695.     with a call to "show()" which returns an integer representing the 
  696.     index of the gitemarray the bar was on when the selection was made. 
  697.     If no selection was made "show()" returns 11.
  698.  
  699.     Let's look at an example to hopefully clear this all up.
  700.  
  701.     gitemarray itemarray;
  702.     Gmenu mymenu;
  703.     Gmenubutton mymenubutton;
  704.     int menuchoice;
  705.  
  706.     strcpy(itemarray[1],"ITEM 1");
  707.     strcpy(itemarray[2],"ITEM 2");
  708.     strcpy(itemarray[3],"ITEM 3");
  709.     strcpy(itemarray[4],"ITEM 4");
  710.  
  711.     setfillstyle(SOLID_FILL,15);        MAKE A MENU BAR AT TOP OF SCREEN
  712.     bar(0,0,getmaxx(),10);
  713.  
  714.     mymenubutton.init(0,0,0,15,15,0,"MENU 1");
  715.     mymenubutton.show();
  716.  
  717.     mymenu.init(0,11,4,itemarray);
  718.  
  719.     if(leftmousekeypressed()) {
  720.         if(mymenubutton.hit()) {
  721.             mymenubutton.press();
  722.             choice=mymenu.show();
  723.             mymenu.hide();
  724.             mymenubutton.show();
  725.             }
  726.         }
  727.  
  728.  
  729.     In this example the integer variable choice will contain the 
  730.     number of the item that was selected. Execution can then branch 
  731.     to the appropriate functions based on this value using case 
  732.     statements.                    
  733.     
  734.  
  735.  
  736.  
  737.  
  738. ***************************************************************************
  739.                 PRINTING TEXT
  740. ***************************************************************************
  741.  
  742.     Although not part of a class library, there is a text output
  743. function included in the library that you will find most useful. The
  744. "outtextxy()" function which is part of the Borland library will only
  745. take a char* as the parameter to write to the screen. You cannot give
  746. it a variable to format into a string for you. There is a function in the
  747. GUI_LIB library called gprintxy() that will format variables into
  748. printable text for you. The definition is:
  749.  
  750.     gprintxy(int,int,char *fmt,...)
  751.  
  752.     You can use this function just as you would the "printf()" function
  753. in text mode. So for example you could write:
  754.  
  755.     int age=27;
  756.     gprintxy(100,100,"%d",age);
  757.  
  758.     "gprintxy()" will format the variable and print it to the screen
  759. correctly. The two integer parameters represent the x and y position to
  760. print the string. Remember that this function is dependent on the current
  761. text justification settings. Use the Borland library function 
  762. "settextjustify()" to alter these settings.
  763.  
  764.  
  765.  
  766. ****************************************************************************
  767.                MOUSE FUNCTIONS
  768. ****************************************************************************
  769.  
  770.     In this section I will briefly describe the functions associated 
  771.     with the mouse. These functions comply with the Microsoft mouse 
  772.     driver, however, they may not represent all of the available 
  773.     function of this driver.
  774.  
  775.     The available functions are as follows:
  776.  
  777. int     mouse_init()    returns 1 if mouse driver is installed, 0 if it                         
  778.             cannot detect a mouse driver.
  779. void    show_cursor()   makes the mouse cursor visible.
  780. void    hide_cursor()   makes the mouse cursor invisible.
  781. void    pos_mouse(int,int)      sets the mouse cursor position to the x,y                               
  782.                 coordinates given as parameters.
  783. void    sethbounds(int,int)     sets the minimum and maximum horizontal                                 
  784.                 mouse cursor boundaries according to the                                
  785.                 parameters.
  786. void    setvbounds(int,int)     sets the minimum and maximum vertical mouse                             
  787.                 cursor boundaries according to the                                      
  788.                 parameters.
  789. int     leftmousekeypressed()   returns 1 if the left mouse key is pressed,                             
  790.                 0 otherwise.
  791. int     rightmousekeypressed()  returns 1 if the right mouse key is pressed,                            
  792.                 0 otherwise.
  793.  
  794.     Future releases of the GUI_LIB library will include the ability 
  795.     to select from a number of available graphics cursors.
  796.  
  797.  
  798.     Well, that about does it. I'm sure that this being the first 
  799.     version of the documentation I will remember some things I should 
  800.     have included after it has already been distributed. Oh well, that's 
  801.     what revisions are for. That's also what registration and telephone 
  802.     support are all about. If you find that you are having trouble 
  803.     getting something to work then be prepared to register your copy 
  804.     of the package before being able to call for support. This is an 
  805.     unregistered copy and is meant for demonstration and evaluation 
  806.     purposes. I know for a fact that all of the methods contained in 
  807.     the library work correctly. I may have not given clear enough 
  808.     directions in this documentation, but if I find that to be the 
  809.     case I will correct the documentation. I cannot give phone 
  810.     support to unregistered users. Sorry.
  811.  
  812.     Don't forget to use the registration form in the file REGISTER.DOC 
  813.     to register your copy of this library package. I feel that it is 
  814.     good quality and very useful software that is well worth the price 
  815.     that I am asking. 
  816.  
  817.          
  818.  
  819.            Thank you for using software from LUDICROUS DATA
  820.     
  821.  
  822.     Note: Refer to the file ICONEDIT.DOC in the ICONEDIT directory for 
  823. a description of the use of the ICONEDIT program.
  824.